home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr01 / jock.zip / TOTDEM11.ZIP / DEMENV1.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-11  |  12KB  |  279 lines

  1. program DEMENV1;
  2. {Shows how the HotSpotIOOBJ object (defined in EXTIO2) can be used
  3.  to integrate pull down menus with IO}
  4.  
  5. USES  DOS, CRT,
  6.       totMENU, totFAST, totIO1, totIO2, EXTIO2, totSTR, totINPUT;
  7.  
  8. var
  9. {Pull dowm menu}
  10.   Env,Watch: MenuOBJ;
  11.   Menu: EZPullArrayOBJ;
  12.   Choice: word;
  13. {IO fields}
  14.   Field1, Field2, Field7: StringIOOBJ;
  15.   Field3, Field4: LateralIOOBJ;
  16.   Field5, Field6: PictureIOOBJ;
  17.   MenuArea,StatusArea: HotSpotIOOBJ;
  18.   Keys: ControlKeysIOOBJ;
  19.   Manager: FormOBJ;
  20.   IOActionCode: tAction;
  21. {Status Menu}
  22.   StatusBar: LotusMenuOBJ;
  23.  
  24. procedure CreateSubMenus;
  25. {}
  26. begin
  27.    with Env do 
  28.    begin
  29.       Init;
  30.       SetForPull;
  31.       AddFullItem(' ~P~references... ',8061,80,'Specify desktop settings',nil);
  32.       AddFullItem(' ~E~ditor...      ',8062,69,'Specify editor settings',nil);
  33.       AddFullItem(' ~M~ouse...       ',8063,77,'Specify mouse settings',nil);
  34.       AddFullItem(' ~S~tartup...     ',8064,83,'Permanently change default startup options',nil);
  35.       AddFullItem(' ~C~olors...      ',8065,67,'Customize IDE colors for windows, menus, etc.',nil);
  36.    end;
  37.    with Watch do
  38.    begin
  39.       Init;
  40.       SetForPull;
  41.       AddFullItem(' ~A~dd watch...       ',7021,65,'Insert a watch expression into the Watch window',nil);
  42.       AddFullItem(' ~D~elete watch       ',7022,68,'Remove the current watch expression from the Watch window',nil);
  43.       AddFullItem(' ~E~dit watch...      ',7023,69,'Edit the current watch expression in the Watch window',nil);
  44.       AddFullItem(' ~R~emove all watches ',7024,82,'Delete all watch expressions from the Watch window',nil);
  45.    end;
  46. end; {CreateSubMenus}
  47.  
  48. procedure CreateMenu;
  49. {}
  50. var
  51.   Mtxt: Array[1..84] of string[100];
  52. begin
  53.    MTxt[1] := '\ ≡ "System Commands';
  54.    MTxt[2] := ' ~A~bout...        "Show version and copyright information"100';
  55.    MTxt[3] := ' ~R~efresh display "Redraw the screen"101';
  56.    MTxt[4] := ' ~C~lear desktop   "Close all windows on the desktop, clear history lists"102';
  57.    MTxt[5] := '\ ~F~ile "File management commands (Open, New, Save, etc.)';
  58.    MTxt[6] := ' ~O~pen...   F3  "Locate and open a file in an edit window"201"317';
  59.    MTxt[7] := ' ~N~ew           "Create a new file in a new Edit window"202';
  60.    MTxt[8] := ' ~S~ave      F2  "Save the file in the active Edit window"203"316';
  61.    MTxt[9] := ' S~a~ve as...    "Save the current file under a different name"204';
  62.    MTxt[10] := ' Save a~l~l      "Save all modified files"205';
  63.    MTxt[11] := '-';
  64.    MTxt[12] := ' ~C~hange dir... "Choose a new default directory"206';
  65.    MTxt[13] := ' ~P~rint         "Print the contents of the active Edit window"207';
  66.    MTxt[14] := ' ~G~et info...   "Show status information"208';
  67.    MTxt[15] := ' ~D~OS shell     "Temporarily exit to DOS"209';
  68.    MTxt[16] := ' E~x~it          "Exit Turbo Pascal"9999';
  69.    MTxt[17] := '\ ~E~dit "Cut-and-paste editing commands"';
  70.    MTxt[18] := '_ ~R~estore line     "Cancel edits to the current line in active Edit window"301';
  71.    MTxt[19] := '-';
  72.    MTxt[20] := '_ Cu~t~    Shift-Del "Remove the selected text and put it in the Clipboard"302';
  73.    MTxt[21] := '_ ~C~opy    Ctrl-Ins "Copy the selected text into the Clipboard"303"9999';
  74.    MTxt[22] := '_ ~P~aste  Shift-Ins "Insert selected text from the Clipboard"304"261';
  75.    MTxt[23] := '_ Copy e~x~ample     "Copy example from the Help window into the ClipBoard"305';
  76.    MTxt[24] := ' ~S~how clipboard   "Open the Clipboard window"306';
  77.    MTxt[25] := '-';
  78.    MTxt[26] := '_ C~l~ear   Ctrl-Del "Delete the selected text"307"262';
  79.    MTxt[27] := '\ ~S~earch "Text and error search commands';
  80.    MTxt[28] := ' ~F~ind...             "Search for text"401';
  81.    MTxt[29] := ' ~R~eplace...          "Search for text and replace it with new text"402';
  82.    MTxt[30] := ' ~S~earch again        "Repeat the last Find or Replace command"403';
  83.    MTxt[31] := ' ~G~oto line number... "Move the cursor to a specified line number"404';
  84.    MTxt[32] := ' ~F~ind procedure...   "Search for a procedure or function while debugging"405';
  85.    MTxt[33] := ' Find e~r~ror...       "Move the cursor to the position of a runtime error"406';
  86.    MTxt[34] := '\ ~R~un "Execute or single-step through a program';
  87.    MTxt[35] := ' ~R~un            Ctrl-F9 "Run the current program"501"358';
  88.    MTxt[36] := '_ ~P~rogram reset  Ctrl-F2 "Halt debugging session and release memory"502"351';
  89.    MTxt[37] := ' ~G~o to cursor        F4 "Run program from the run bar to the cursor position"503"318';
  90.    MTxt[38] := ' ~T~race into          F7 "Execute next statement, stopping within the current proc"504"321';
  91.    MTxt[39] := ' ~S~tep over           F8 "Execute next statement, skipping over the current proc"505"322';
  92.    MTxt[40] := ' P~a~rameters...          "Set command line parameters to be passed to the program"506';
  93.    MTxt[41] := '\ ~C~ompile "Compile to disk or memory';
  94.    MTxt[42] := ' ~C~ompile  Alt-F9 "Compile source file"601"368';
  95.    MTxt[43] := ' ~M~ake         F9 "Rebuild source file and all modified files"602"323';
  96.    MTxt[44] := ' ~B~uild           "Rebuild source file and all files"603';
  97.    MTxt[45] := ' ~D~estination     "Specify whether file is compiled to memory or disk"604';
  98.    MTxt[46] := ' ~P~rimary file... "Define the file that is the focus of make and Build"605';
  99.    MTxt[47] := '\ ~D~ebug "Evaluate expressions, modify data, set breakpoints and watches';
  100.    MTxt[48] := ' ~E~valute/modify...  Ctrl-F4 "Evaluate a variable or expression and display or modify the value"701"353';
  101.    MTxt[49] := ' ~W~atches                   "Add, delete and edit expressions in the watch window"702';
  102.    MTxt[50] := ' ~T~oggle breakpoint  Ctrl-F8 "Set or clear an unconditional breakpoint at the cursor position"703"357';
  103.    MTxt[51] := ' ~B~reakpoints...    "Set conditional breakpoints, view and edit breakpoints"704';
  104.    MTxt[52] := '\ ~O~ptions "Set defaults for compiler, editor, mouse, debugger, etc.';
  105.    MTxt[53] := ' ~C~ompiler            "Set default compiler directives and condl. defines"801';
  106.    MTxt[54] := ' ~M~emory sizes...     "Set default stack and heap sizes for generated programs"802';
  107.    MTxt[55] := ' ~L~inker...           "Set linker options"803';
  108.    MTxt[56] := ' De~b~ugger...         "Set debugger options"804';
  109.    MTxt[57] := ' ~D~irectories...      "Set paths for units, include files, OBJs anfd generated files"805';
  110.    MTxt[58] := '-';
  111.    MTxt[59] := ' ~E~nvironment        "Specify environment settings"806';
  112.    MTxt[60] := '-';
  113.    MTxt[61] := ' ~S~ave options...     "Save all the settings you''ve made in the Options menu"807';
  114.    MTxt[62] := ' ~R~etrieve options... "Load options file previously created with Save Options"808';
  115.    MTxt[63] := '\ ~W~indow "Open, arrange, and list windows';
  116.    MTxt[64] := ' ~S~ize/Move   Ctrl-F5 "Change the size or position of the active window"901"354';  
  117.    MTxt[65] := ' ~Z~oom             F5 "Enlarge or restore the size of the active window"902"319';
  118.    MTxt[66] := ' ~T~ile                "Arrange windows on desktop by tiling"903';
  119.    MTxt[67] := ' C~a~scade             "Arrange windows on desktop by cascading"904';
  120.    MTxt[68] := ' ~N~ext             F6 "Make the next window active"905"320';
  121.    MTxt[69] := ' ~P~revious   Shift-F6 "Make the previous window active"906"345';
  122.    MTxt[70] := ' ~C~lose        Alt-F3 "Close the active window"907"362';
  123.    MTxt[71] := '-';
  124.    MTxt[72] := ' ~W~atch               "Open the watch window"908';
  125.    MTxt[73] := ' ~R~egister            "Open the Register window"909';
  126.    MTxt[74] := ' ~O~utput              "Open the Output window"910';
  127.    MTxt[75] := ' Call stac~k~  Ctrl-F3 "Show the procedures the program called to reach this point"911"352';
  128.    MTxt[76] := ' ~U~ser screen  Alt-F5 "Switch to the full-screen user output"912"364';
  129.    MTxt[77] := '-';
  130.    MTxt[78] := ' ~L~ist...       Alt-0 "Show a list of all open windows"913"385';
  131.    MTxt[79] := '\ ~H~elp "Get online help';
  132.    MTxt[80] := ' ~C~ontents               "Show table of contents of online Help"1001';
  133.    MTxt[81] := ' ~I~ndex         Shift-F1 "Show index for online Help"1002"340';
  134.    MTxt[82] := ' ~T~opic Search   Ctrl-F1 "Display help on the word at the cursor"1003"350';
  135.    MTxt[83] := ' ~P~revious Topic  Alt-F1 "Redisplay the last-viewed online Help screen"1004"360';
  136.    MTxt[84] := ' ~H~elp on Help           "How to use online Help"1005';
  137.    with Menu do
  138.    begin
  139.       Init;
  140.       AssignList(MTxt,84,100);
  141.    end;
  142.    CreateSubMenus;
  143.    with Menu do
  144.    begin
  145.       SubMenu(7)^.SetSubMenu(2,@Watch);
  146.       SubMenu(8)^.SetSubMenu(7,@Env);
  147.    end;
  148. end; {CreateMenu}
  149.  
  150. {++++++++++++++++++++++++ IO STUFF +++++++++++++++++++++++++++++++}
  151. procedure InitVars;
  152. {}
  153. begin
  154.    with Field1 do
  155.    begin
  156.       Init(40,5,10);
  157.       SetLabel('Field 1  (StringIOOBJ)');
  158.    end;
  159.    with Field2 do
  160.    begin
  161.       Init(40,7,10);
  162.       SetLabel('Field 2  (StringIOOBJ)');
  163.       SetCase(upper);
  164.       SetValue('hello');
  165.       SetRules(EraseDefault+JumpIfFull);
  166.    end;
  167.    with Field3 do
  168.    begin
  169.       Init(40,9,15,30);
  170.       SetLabel('Field 3 (LateralIOOBJ)');
  171.    end;
  172.    with Field4 do
  173.    begin
  174.       Init(40,11,15,30);
  175.       SetLabel('Field 4 (LateralIOOBJ)');
  176.       SetCase(Upper);
  177.       SetForcecase(True);
  178.       SetCursor(CursLeft);
  179.    end;
  180.    with Field5 do
  181.    begin
  182.       Init(40,13,'(###) ###-####');
  183.       SetLabel('Field 5 (PictureIOOBJ)');
  184.    end;
  185.    with Field6 do
  186.    begin
  187.       Init(40,15,'!!!***@@@###');
  188.       SetLabel('Field 6 (PictureIOOBJ)');
  189.       SetDisAllowChar('aAbBcC123@!');
  190.       SetRules(EraseDefault);
  191.    end;
  192.    with Field7 do
  193.    begin
  194.       Init(40,17,10);
  195.       SetLabel('Field 7  (StringIOOBJ)');
  196.       SetDispChar('#');
  197.    end;
  198. {++++++++++++++++++++++++++++++++++++++++}
  199.    MenuArea.Init(1,1,80,1,Stop1);
  200.    StatusArea.Init(1,25,80,25,Stop2);
  201. {++++++++++++++++++++++++++++++++++++++++}
  202.    Keys.Init;
  203.    with manager do
  204.    begin
  205.       Init;
  206.       AddItem(Keys);
  207.       AddItem(MenuArea);
  208.       AddItem(StatusArea);
  209.       AddItem(Field1);
  210.       AddItem(Field2);
  211.       AddItem(Field3);
  212.       AddItem(Field4);
  213.       AddItem(Field5);
  214.       AddItem(Field6);
  215.       AddItem(Field7);
  216.    end;
  217. end; {InitVars}
  218.  
  219. {++++++++++++++++++++++++ Status Bar Stuff ++++++++++++++++++++++++}
  220. procedure CreateStatusBar;
  221. {}
  222. begin
  223.    with StatusBar do
  224.    begin
  225.       Init;
  226.       AddItem('~F1~ Help  ');
  227.       AddItem('~F2~ Save  ');
  228.       AddItem('~F3~ Open  ');
  229.       AddItem('~F4~ You  ');
  230.       AddItem('~F5~ get  ');
  231.       AddItem('~F6~ the  ');
  232.       AddItem('~F7~ idea!  ');
  233.       SetMenuXY(2,25);
  234.    end;
  235. end; {CreateStatusBar}
  236.  
  237. procedure DisposeVars;
  238. {}
  239. begin
  240.    Field1.Done;
  241.    Field2.Done;
  242.    Field3.Done;
  243.    Field4.Done;
  244.    Field5.Done;
  245.    Field6.Done;
  246.    Field7.Done;
  247.    Keys.Done;
  248.    Menu.Done;
  249.    Env.Done;
  250.    Watch.Done;
  251. end; {DisposeVars}
  252.  
  253. begin
  254.    ClrScr;
  255.    Screen.PartClear(1,2,80,24,white,'░'); {paint the screen}
  256.    Screen.PartClear(1,1,80,1,31,' ');
  257.    Screen.FillBox(10,3,70,19,79,1);
  258.    Screen.WriteCenter(19,79,' Press Tab to change fields. F10 to finish. ');
  259.    CreateMenu;
  260.    InitVars;
  261.    CreateStatusBar;
  262.    Menu.MainMenu^.Draw;
  263.    StatusBar.Draw;
  264.    repeat
  265.       IOActionCode := Manager.Go;       {Start IO session}
  266.       with Key do
  267.          if IOActionCode = Stop1 then   {User clicked on menu bar}
  268.          begin
  269.             Screen.WritePlain(10,25,'│');
  270.             Screen.PartClear(11,25,80,25,31,' ');
  271.             Choice := Menu.Push(LastKey,LastX,LastY);
  272.             StatusBar.Draw;
  273.          end
  274.          else if IOActionCode = Stop2 then   {User clicked on Status bar}
  275.             Choice := StatusBar.Push(LastKey,LastX,LastY);
  276.    until (not (IOActionCode in [Stop1,Stop2])) or (Choice = 9999);
  277.    DisposeVars;
  278. end.
  279.